# b1 = b'fdjkslafjsadlkfdsffdklsafdkfdjskfdslfksdfkldsafdsjafffffffffffffffffffffffjdskljsalkfjdsalkfjdsalkfjsdalkfjsdalkfjdsalkfjdsalkfjs'
# len_b1 = len(b1)
# print(len_b1)  # 129
# # 129 ---> str --- >bytes
# s1 = str(len_b1).encode('utf-8')
# print(s1)
# print(len(s1))

# import struct
# # 将一个数字转化成等长度的bytes类型。
# ret = struct.pack('i', 1543654000)
# # print(ret, type(ret), len(ret))
#
# # # 通过unpack反解回来
# ret1 = struct.unpack('i',ret)[0]
# print(ret1)

b1 = b''
b1 = b1+ b'abc'
b1 = b1 + b'rty'
print(b1,len(b1))

import json
import struct
head_dict = {
    'MD5': 'fdsaf2345544324dfs',
    'file_name': '婚前视频',
    'file_size': 15436540006555555555555555556556546546565654654654654645555555555555555555555555555555555555,
}

head_len = len(json.dumps(head_dict).encode('utf-8'))
print(head_len)

ret = struct.pack('i', head_len)
print(ret)